package tools;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class OptionReader {

	String StartLine = "";// Testen ob es ein Optionsfile ist
	String calOptStandardView = ""; // week = Wochenansicht, alles andere ist
									// Monatsansicht
	String calOpt2 = "";
	String calOpt3 = "";

	String conOpt1 = "";
	String conOpt2 = "";
	String conOpt3 = "";

	String toDoOpt1 = "";
	String toDoOpt2 = "";
	String toDoOpt3 = "";

	String mailOpt1 = "";
	String mailOpt2 = "";
	String mailOpt3 = "";

	String language = ""; // welche Sprache geladen werden soll, 0=deutsch, 1=
							// Englisch, 2= Latein
	String colorSetting = "";// Farbe --> xxx,xxx,xxx
	String allOpt3 = "";

	ArrayList<String> optionsList;

	public ArrayList<String> getOptionsList() {
		return optionsList;
	}

	public void setOptionsList(ArrayList<String> optionsList) {
		this.optionsList = optionsList;
	}

	public OptionReader() {

	}

	public ArrayList<String> returnList() {

		optionsList = new ArrayList<String>();

		optionsList.add(StartLine);
		optionsList.add(calOptStandardView);
		optionsList.add(calOpt2);
		optionsList.add(calOpt3);
		optionsList.add(conOpt1);
		optionsList.add(conOpt2);
		optionsList.add(conOpt3);
		optionsList.add(toDoOpt1);
		optionsList.add(toDoOpt2);
		optionsList.add(toDoOpt3);
		optionsList.add(mailOpt1);
		optionsList.add(mailOpt2);
		optionsList.add(mailOpt3);
		optionsList.add(language);
		optionsList.add(colorSetting);
		optionsList.add(allOpt3);

		return optionsList;

	}

	public ArrayList<String> getOpionsFromFile() throws IOException {
		optionsList = new ArrayList<String>();

		FileReader fr = new FileReader("files/options.fof");
		BufferedReader br = new BufferedReader(fr);

		StartLine = br.readLine();
		if (StartLine.equals("*FireBallOptionsFile*")) {

			optionsList.add(StartLine);
			calOptStandardView = br.readLine();
			optionsList.add(calOptStandardView);
			calOpt2 = br.readLine();
			optionsList.add(calOpt2);
			calOpt3 = br.readLine();
			optionsList.add(calOpt3);
			conOpt1 = br.readLine();
			optionsList.add(conOpt1);
			conOpt2 = br.readLine();
			optionsList.add(conOpt2);
			conOpt3 = br.readLine();
			optionsList.add(conOpt3);
			toDoOpt1 = br.readLine();
			optionsList.add(toDoOpt1);
			toDoOpt2 = br.readLine();
			optionsList.add(toDoOpt2);
			toDoOpt3 = br.readLine();
			optionsList.add(toDoOpt3);
			mailOpt1 = br.readLine();
			optionsList.add(mailOpt1);
			mailOpt2 = br.readLine();
			optionsList.add(mailOpt2);
			mailOpt3 = br.readLine();
			optionsList.add(mailOpt3);
			language = br.readLine();
			optionsList.add(language);
			colorSetting = br.readLine();
			optionsList.add(colorSetting);
			allOpt3 = br.readLine();
			optionsList.add(allOpt3);

		}

		br.close();
		return optionsList;

	}

	public String arrayListToString(ArrayList<String> options) {
		String str = "";

		for (int i = 0; i < options.size(); i++) {
			str = str + options.get(i) + "\n";
		}

		return str;

	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getColorSetting() {
		return colorSetting;
	}

	public void setColorSetting(String colorSetting) {
		this.colorSetting = colorSetting;
	}

	public String getAllOpt3() {
		return allOpt3;
	}

	public void setAllOpt3(String allOpt3) {
		this.allOpt3 = allOpt3;
	}

	public String getStartLine() {
		return StartLine;
	}

	public void setStartLine(String startLine) {
		StartLine = startLine;
	}

	public String getCalOptStandardView() {
		return calOptStandardView;
	}

	public void setCalOptStandardView(String calOptStandardView) {
		this.calOptStandardView = calOptStandardView;
	}

	public String getCalOpt2() {
		return calOpt2;
	}

	public void setCalOpt2(String calOpt2) {
		this.calOpt2 = calOpt2;
	}

	public String getCalOpt3() {
		return calOpt3;
	}

	public void setCalOpt3(String calOpt3) {
		this.calOpt3 = calOpt3;
	}

	public String getConOpt1() {
		return conOpt1;
	}

	public void setConOpt1(String conOpt1) {
		this.conOpt1 = conOpt1;
	}

	public String getConOpt2() {
		return conOpt2;
	}

	public void setConOpt2(String conOpt2) {
		this.conOpt2 = conOpt2;
	}

	public String getConOpt3() {
		return conOpt3;
	}

	public void setConOpt3(String conOpt3) {
		this.conOpt3 = conOpt3;
	}

	public String getToDoOpt1() {
		return toDoOpt1;
	}

	public void setToDoOpt1(String toDoOpt1) {
		this.toDoOpt1 = toDoOpt1;
	}

	public String getToDoOpt2() {
		return toDoOpt2;
	}

	public void setToDoOpt2(String toDoOpt2) {
		this.toDoOpt2 = toDoOpt2;
	}

	public String getToDoOpt3() {
		return toDoOpt3;
	}

	public void setToDoOpt3(String toDoOpt3) {
		this.toDoOpt3 = toDoOpt3;
	}

	public String getMailOpt1() {
		return mailOpt1;
	}

	public void setMailOpt1(String mailOpt1) {
		this.mailOpt1 = mailOpt1;
	}

	public String getMailOpt2() {
		return mailOpt2;
	}

	public void setMailOpt2(String mailOpt2) {
		this.mailOpt2 = mailOpt2;
	}

	public String getMailOpt3() {
		return mailOpt3;
	}

	public void setMailOpt3(String mailOpt3) {
		this.mailOpt3 = mailOpt3;
	}

}
